1. Field of the Invention
The present invention relates to a technique for encoding image data on the basis of a coding system such as MPEG, H.264, or the like.
2. Description of the Background Art
Images to be delivered on digital broadcasts, those to be stored in media such as DVDs (Digital Versatile Disks) and hard disks, and the like are compressed according to various coding systems. The object for such compressions is to suppress a transmission band, increase the transmission rate, decrease the memory size, or the like.
One of the coding systems that have been conventionally adopted is MPEG2. The MPEG2 is a coding system that can be used for communication media or broadcasting media, as well as for recording in recording media. Specifically, the MPEG2 is widely used in digital broadcasts, video conferences, videophone systems, or the like.
Another coding system, other than the MPEG2, is H.264. The H.264 achieves a compression ratio twice to four times as high as that of the MPEG2. Since there are a plurality of different coding systems, coding system conversion is sometimes performed in order to reduce the amount of codes in coded image data.
A transcoder disclosed in Japanese Patent Application Laid Open Gazette No. 2008-42426 comprises a decoder for decoding image data encoded according to MPEG2 and an encoder for encoding again the decoded image data according to H.264. The encoder calculates a macroblock evaluation value and an average macroblock evaluation value from the decode image data. The macroblock evaluation value is an evaluation value indicating the degree of dispersion of pixels in a macroblock and calculated for each macroblock. The average macroblock evaluation value is an average value of the macroblock evaluation values for one frame. On the basis of the difference between the macroblock evaluation value and the average macroblock evaluation value, a quantization step value is determined for each macroblock.
The macroblock evaluation value sometimes locally varies in a frame. For example, an object macroblock to be encoded is present in an area where the proportion of macroblocks each having a small macroblock evaluation value is high. If the macroblock evaluation value of the object macroblock is larger than macroblock evaluation values of surrounding macroblocks, the object macroblock is quantized more coarsely than the surrounding macroblocks. As a result, the subjective image quality of the recoded image data decreases.
The object macroblock is sometimes present in an area where the proportion of macroblocks each having a large macroblock evaluation value is high. In this case, if the macroblock evaluation value of the object macroblock is smaller than macroblock evaluation values of surrounding macroblocks, the object macroblock is quantized more finely than the surrounding macroblocks. When the object macroblock is quantized finely, the amount of codes in the recoded image data increases but this does not contribute so much to an improvement of the subjective image quality of the recoded image data.